@require "../../../css/variables.styl"
@require "../../../css/mixin.styl"

.date-picker-wrapper
  position relative

.icon-arrow-left:before
  content '‹'

.icon-arrow-right:before
  content '›'

.icon-d-arrow-left:before
  content '«'

.icon-d-arrow-right:before
  content '»'

.picker-panel {
  color: $datePicker-color;
  border: 1px solid $datePicker-border-color;
  box-shadow: 0 2px 6px #ccc;
  background: #fff;
  border-radius: 2px;
  line-height: 20px;
  position: absolute;
  top: 34px;
  left: 0;
  z-index: 3000;

  .picker-panel__body, .picker-panel__body-wrapper {
    &:after {
      content: "";
      display: table;
      clear: both;
    }
  }

  .picker-panel__content {
    position: relative;
  }

  &:not(.date-range-picker) .picker-panel__content {
    margin: 15px;
  }

  .picker-panel__footer {
    border-top: 1px solid $datePicker-inner-border-color;
    padding: 4px;
    text-align: right;
    background-color: #fff;
    position: relative;
  }

  .picker-panel__shortcut {
    display: block;
    width: 100%;
    border: 0;
    background-color: transparent;
    line-height: 28px;
    font-size: 14px;
    color: $datePicker-color;
    padding-left: 12px;
    text-align: left;
    outline: none;
    cursor: pointer;

    &:hover {
      background-color: $datePicker-cell-hover-color;
    }

    &.active {
      background-color: #e6f1fe;
      color: $datePicker-active-color;
    }
  }

  .picker-panel__btn {
    border: 1px solid #dcdcdc;
    color: #333;
    line-height: 24px;
    border-radius: 2px;
    padding: 0 20px;
    cursor: pointer;
    background-color: transparent;
    outline: none;
    font-size: 12px;
    &:hover {
      background-color: $color-primary;
      color: #fff;
    }

    &[disabled] {
      color: #cccccc;
      cursor: not-allowed;
    }
  }

  .picker-panel__icon-btn {
    font-size: 22px;
    color: $datePicker-icon-color;
    border: 0;
    background: transparent;
    cursor: pointer;
    outline: none;

    &:hover {
      color: $datePicker-text-hover-color;
    }
  }

  .picker-panel__link-btn {
    cursor: pointer;
    color: $color-primary;
    text-decoration: none;
    padding: 0 10px;
    font-size: 12px;
  }
}

.picker-panel *[slot=sidebar],
.picker-panel__sidebar {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 110px;
  border-right: 1px solid $datePicker-inner-border-color;
  box-sizing: border-box;
  padding-top: 6px;
  background-color: #fff;
  overflow: auto;
}

.picker-panel *[slot=sidebar] + .picker-panel__body,
.picker-panel__sidebar + .picker-panel__body {
  margin-left: 110px;
}


.time-panel {
//position: absolute;
//top: 34px;
//left: 5px;
//right: 5px;
//z-index: 3001;
  text-align: center;
  white-space: nowrap;
//background: #fff;
//border: solid 1px #ccc;
  display: inline-block;
  vertical-align: middle;
  height: 34px;
//padding: 0 10px;
//box-shadow: 0 2px 6px #ccc;

  select{
    display: inline-block;
    width: 45px;
    height: 23px;
    font-size: 14px;
    margin-top: 6px;
  }
}

.time-panel__footer {
  display: block;
  text-align: right;
  padding-right: 4px;
  button {
    margin-top: 10px;
    display: inline-block;
    font-size: 12px;
    vertical-align: middle;
    height: 24px;

    border: 1px solid #dcdcdc;
    color: #333;
    border-radius: 2px;
    padding: 0 10px;
    cursor: pointer;
    background-color: transparent;
    outline: none;

    &:hover {
      background: $color-primary;
      color: #fff;
    }
  }
}


.date-picker {
  min-width: 254px;

  &.has-sidebar.has-time {
    min-width: 434px;
  }

  &.has-sidebar {
    min-width: 370px;
  }

  &.has-time {
    min-width: 324px;
  }

  .picker-panel__content {
    min-width: 224px;
  }

  table {
    table-layout: fixed;
    width: 100%;
  }

  .date-picker__editor-wrap {
    position: relative;
    display: table-cell;
    padding: 0 5px;
  }

  .date-picker__time-header {
    position: relative;
    border-bottom: 1px solid $datePicker-inner-border-color;
    font-size: 12px;
    padding: 8px 5px;
    display: table;
    width: 100%;
    box-sizing: border-box;

    input {
      width: 100% !important;
    }
  }

  .date-picker__header {
    padding: 0 10px;
    text-align: center;

    button, span{
      line-height: 40px;
      display: inline-block;
      vertical-align: middle;
    }
  }

  .date-picker__header-label {
    font-size: 14px;
    padding: 0 5px;
    line-height: 22px;
    text-align: center;
    cursor: pointer;

    &:hover {
      color: var(--datepicker-text-hover-color);
    }

    &.active {
      color: var(--datepicker-active-color);
    }
  }

  .date-picker__prev-btn {
    float: left;
  }

  .date-picker__next-btn {
    float: right;
  }

  .date-picker__time-wrap {
    padding: 10px;
    text-align: center;
  }

  .date-picker__time-label {
    float: left;
    cursor: pointer;
    line-height: 30px;
    margin-left: 10px;
  }
}

.date-range-picker {
  min-width: 520px;

  &.has-sidebar.has-time {
    min-width: 766px;
  }

  &.has-sidebar {
    min-width: 620px;
  }

  &.has-time {
    min-width: 660px;
  }

  table {
    table-layout: fixed;
    width: 100%;
  }

  .picker-panel__body {
    min-width: 513px;
  }

  .picker-panel__content {
    margin: 0;
  }

  .date-range-picker__header {
    position: relative;
    text-align: center;
    height: 28px;

    button {
      float: left;
    }

    div {
      font-size: 14px;
      margin-right: 50px;
    }
  }

  .date-range-picker__content {
    float: left;
    width: 50%;
    box-sizing: border-box;
    margin: 0;
    padding: 16px;

    &.is-left {
      border-right: 1px solid $datePicker-inner-border-color;
    }

    &.is-right {
      .date-range-picker__header {
        button {
          float: right;
        }

        div {
          margin-left: 50px;
          margin-right: 50px;
        }
      }
    }
  }

  .date-range-picker__editors-wrap {
    box-sizing: border-box;
    display: table-cell;

    &.is-right {
      text-align: right;
    }
  }

  .date-range-picker__time-header {
    position: relative;
    border-bottom: 1px solid $datePicker-inner-border-color;
    font-size: 12px;
    padding: 8px 5px 5px 5px;
    display: table;
    width: 100%;
    box-sizing: border-box;

    > .icon-arrow-right {
      /*font-family: FontAwesome;*/
      font-size: 20px;
      vertical-align: middle;
      display: table-cell;
      color: $datePicker-icon-color;
    }
  }

  .date-range-picker__time-picker-wrap {
    position: relative;
    display: table-cell;
    padding: 0 5px;

    .picker-panel {
      position: absolute;
      top: 13px;
      right: 0;
      z-index: 1;
      background: #fff;
    }
  }
}

.date-table {
  font-size: 12px;
  min-width: 224px;
  user-select: none;

  .is-week-mode{
    .date-table-row{
      &:hover{
        background-color: $datePicker-cell-hover-color;
      }

      &.current{
        background-color: $datePicker-range-color;
      }
    }
  }

  td {
    width: 32px;
    height: 32px;
    box-sizing: border-box;
    text-align: center;
    cursor: pointer;

    &.next-month,
    &.prev-month {
      color: $datePicker-off-color;
    }

    &.today {
      color: $datePicker-text-hover-color;
      position: relative;
      &:before {
        content: " ";
        position: absolute;
        top: 0px;
        right: 0px;
        width: 0;
        height: 0;
        border-top: 0.5em solid $datePicker-active-color;
        border-left: .5em solid transparent;
      }
      &.in-range:before {
        border-top: 0.5em solid lighten($datePicker-active-color, 10%);
      }

    }

    &.available:hover {
      background-color: $datePicker-cell-hover-color;
    }
    &.available.in-range:hover {
      color: #fff;
    }

    &.in-range {
      background-color: $datePicker-range-color;
      &:hover {
        background-color: $datePicker-range-hover-color;
      }
    }

    &.current:not(.disabled),
    &.start-date,
    &.end-date {
      background-color: $datePicker-active-color !important;
      color: #fff;
    }

    &.disabled {
      background-color: #f4f4f4;
      opacity: 1;
      cursor: not-allowed;
      color: #ccc;
    }

    &.week {
      font-size: 80%;
      color: $datePicker-header-color;
    }
  }

  th {
    padding: 5px;
    text-align: center;
    color: $datePicker-header-color;
    font-weight: 400;
  }
}

.month-table {
  font-size: 12px;
  margin: -1px;
  border-collapse: collapse;

  td {
    text-align: center;
    padding: 20px 3px;
    cursor: pointer;

    &.disabled .cell {
      background-color: #f4f4f4;
      cursor: not-allowed;
      color: #ccc;
    }

    &.disabled .cell:hover{
      text-decoration: none;
    }

    .cell {
      width: 48px;
      height: 32px;
      display: block;
      line-height: 32px;
      color: $datePicker-color;
    }

    &:not(.disabled) .cell:hover{
      background-color: $datePicker-cell-hover-color;
      text-decoration: none;
    }

    &.current:not(.disabled) .cell {
      background-color: $datePicker-active-color !important;
      color: #fff;
    }
  }
}

.year-table {
  font-size: 12px;
  margin: -1px;
  border-collapse: collapse;

  .el-icon {
    color: $datePicker-icon-color;
  }

  td {
    text-align: center;
    padding: 20px 3px;
    cursor: pointer;

    &.disabled .cell {
      background-color: #f4f4f4;
      cursor: not-allowed;
      color: #ccc;
    }

    &.disabled .cell:hover{
      text-decoration: none;
    }

    .cell {
      width: 48px;
      height: 32px;
      display: block;
      line-height: 32px;
      color: $datePicker-color;
    }

    &:not(.disabled) .cell:hover{
      background-color: $datePicker-cell-hover-color;
      text-decoration: none;
    }

    &.current:not(.disabled) .cell {
      background-color: $datePicker-active-color !important;
      color: #fff;
    }
  }
}
